package zheezes.eisp.monitor.model;

import java.text.SimpleDateFormat;
import java.util.ResourceBundle;

import zheezes.eisp.LocaleResources;
import zheezes.eisp.data.orm.CollectTask;
import zheezes.model.ObservableModel;


public class TaskVo extends ObservableModel {
	private CollectTask model;
	
	private ResourceBundle resourceBundle;

	public TaskVo() {
	}

	public TaskVo(CollectTask model) {
		this.model = model;
	}

	public String getTaskType() {
		switch (model.getType().intValue()) {
		case 2:
			return resourceBundle.getString(LocaleResources.VAR_VIP_OCLOCK_FROZEN);
		case 3:
			return resourceBundle.getString(LocaleResources.VAR_METER_RESIDENT_DAILY_FROZEN);
		default:
			return resourceBundle.getString(LocaleResources.VAR_UNKNOWN_TASK_TYPE);
		}
	}
	
	public Integer getTotalNum() {
		return model.getTotalNum();
	}
	
	public Integer getCollectedNum() {
		return model.getCollectedNum();
	}

	public String getRunDate() {
		SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd");
		return fmt.format(model.getDataDate());
	}

	public CollectTask getModel() {
		return model;
	}

	public void setModel(CollectTask model) {
		this.model = model;
	}

	public void setResourceBundle(ResourceBundle resourceBundle) {
		this.resourceBundle = resourceBundle;
	}
}
